home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / ArchiveUtils / PackageInspector-0.96 / PackageInspector.bundle / archbom next >
Text File  |  1995-07-30  |  3KB  |  91 lines

  1. #! /bin/sh
  2. #+++
  3. #  RCS archbom,v 1.2 1995/07/30 21:04:01 tom Exp
  4. #  title:    archbom
  5. #  abstract:    Determine architectures of *.bom file
  6. #  author:    T.R.Hageman
  7. #  created:    July 1995
  8. #  modified:    (see RCS Log at end)
  9. #  copyleft:
  10. #
  11. #        Copyright (C) 1995  Tom R. Hageman.
  12. #
  13. #    This is free software; you can redistribute it and/or modify
  14. #    it under the terms of the GNU General Public License as published by
  15. #    the Free Software Foundation; either version 2 of the License, or
  16. #    (at your option) any later version.
  17. #
  18. #    This software is distributed in the hope that it will be useful,
  19. #    but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21. #    GNU General Public License for more details.
  22. #
  23. #    You should have received a copy of the GNU General Public License
  24. #    along with this software; if not, write to the Free Software
  25. #    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  26. #
  27. #  description:
  28. #
  29. #    This script is part of PackageInspector
  30. #
  31. #    Determine architectures supported by Installer package's *.bom
  32. #    (this method is slow, but requires no internal knowledge of the .bom
  33. #     format)
  34. #---
  35.  
  36. # Extend this when NS supports more archs than the ones in 3.3
  37. CHECKARCHS='m68k i386 hppa sparc'
  38.  
  39. # Assume NS never gets ported to this.
  40. DUMMYARCH=vax
  41.  
  42. lsbom='/usr/etc/lsbom'
  43.  
  44. bom="$1"
  45.  
  46. [ -n "$bom" ] || { echo "Usage: `basename $0` bom"; exit 1; }
  47. [ -r "$bom" ] || { echo "???"; exit 1; }
  48.  
  49. # If lsbom not present, assume we're running on a pre-3.1 system.
  50. # There's nothing much we can do without it ...
  51. [ -r $lsbom ] || { echo "old"; exit 0; }
  52.  
  53. all_lines=`$lsbom -s $bom 2>/dev/null | wc -l`
  54.  
  55. # If no lines, assume *.bom is in pre-fat ASCII format.
  56. # (in which case the package contains either m68k software or
  57. #  architecture-independent stuff; we have no way of knowing...)
  58.  
  59. [ $all_lines = 0 ] && { echo "old"; exit 0; }
  60.  
  61. none_lines=`$lsbom -s -arch $DUMMYARCH $bom 2>/dev/null | wc -l`
  62.  
  63. [ $all_lines = $none_lines ] && { echo "any"; exit 0; }
  64.  
  65. sep=
  66. for a in $CHECKARCHS
  67. do
  68.     lines=`$lsbom -s -arch $a $bom 2>/dev/null | wc -l`
  69.     if [ $lines -gt $none_lines ]
  70.     then
  71.         if [ $lines -lt $all_lines ]
  72.         then
  73.             echo -n "$sep($a)"
  74.         else
  75.             echo -n "$sep$a"
  76.         fi
  77.         sep=", "
  78.     fi
  79. done
  80. echo
  81.  
  82. exit 0
  83.  
  84. #=======================================================================
  85. # archbom,v
  86. # Revision 1.2  1995/07/30 21:04:01  tom
  87. # stdheader added; detect partial arch support; indicate this with
  88. # parenthizing archname; output arch names as soon as detected.
  89. #
  90. #=======================================================================
  91.